package com.hancher.common.androidutil;

import android.view.KeyEvent;

/**
 * 描述 :  <br/>
 * 时间 : 2024/1/4 13:42 <br/>
 * 作者 : Hancher ytu_shaoweijie@163.com
 */
public class KeyEventUtil {
    public static boolean isEnter(int keycode) {
        return keycode == KeyEvent.KEYCODE_SEARCH || keycode == KeyEvent.KEYCODE_ENTER
                || keycode == KeyEvent.KEYCODE_NUMPAD_ENTER || keycode == KeyEvent.KEYCODE_DPAD_CENTER;
    }

    public static boolean isEnterUp(KeyEvent keyEvent) {
        return keyEvent != null && keyEvent.getAction() == KeyEvent.ACTION_UP && isEnter(keyEvent.getKeyCode());
    }
}
